/**
 * 
 */
package org.arpit.masteringextjs.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.arpit.masteringextjs.jsonserializer.GroupToIdSerializer;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;

/**
 * @author Arpit.Rathore
 *
 */
@Entity
public class User extends BaseEntity {

	private String name;

	@Column(unique = true)
	private String userName;
	private String password;
	private String email;
	private String picture;

	@ManyToOne
	@JoinColumn
	private Groups groups;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@JsonIgnore
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	@JsonSerialize(using = GroupToIdSerializer.class, as = Groups.class)
	@JsonProperty("group_id")
	public Groups getGroups() {
		return groups;
	}

	public void setGroups(Groups groups) {
		this.groups = groups;
	}

	public static void main(String[] args) {

	}
}
